<template>
  <div class="login-bg">
    <div class="box">
    <h2>微前端+微服务开发平台</h2>
    <form>
      <div class="item">
        <input type="text" v-model="username">
        <label class="lable-i">请输入用户名</label>
      </div>
      <div class="item">
        <input type="password" v-model="password">
        <label class="lable-i">请输入密码</label>
      </div>
      <div @click="login" class="btn">登 录</div>
    </form>
  </div>
  </div>
</template>

<script>
export default {
  name:'login',
  data(){
    return{
      username:'',
      password:''
    }
  },
  methods:{
    login(){
      if(!this.username){
        this.$message.error('用户名不能控!');
        return;
      }
      if(!this.password){
        this.$message.error('密码不能控!');
        return;
      }
      this.$message.success('登录成功')

      // 登录逻辑
      setTimeout(()=>{
        this.$router.push({
          path:'/'
        })
      },1500)
    }
  }

}
</script>

<style scoped>
.login-bg{
  background-image: url('../assets/bg.jpg');
  width: 100%;
  height: 100vh;
  background-repeat: no-repeat; 
  display: flex;
  justify-content: center;
  align-items: center;
}
.switch{
    width: 470px;
    margin: 20px auto;
    padding: 0;
    text-align: center;
}
.logBtn,.regBtn{
    font-size: 20px;
    display: inline-block;
    width: 226px;
    padding: 10px 0;
    background-color: lightcyan;
    margin: 30px auto 0 auto;
    border-radius: 5px;
    cursor: pointer;
    color: black;
    transition: all 0.2s linear;
}
.logBtn:hover,.regBtn:hover{
    background-color: yellow;
}

.box{
    width: 400px;
    background-color: black;
    border-radius: 10px;
    margin: 0px auto;
    padding: 30px;
    opacity: 0.7;
    min-height: 320px;
    text-align: center;
}
h2{
    color: white;
    text-align: center;
    margin-bottom: 35px;
}
.item{
    height: 45px;
    width: 88%;
    color: #03e9f4;
    border-bottom: 1px solid #fff;
    margin: 0 auto;
    margin-bottom: 40px;
    position: relative;
}        
.item input{
    font-size: 18px;
    color: #03e9f4;
}
.item input:focus+label,.item input:valid+label{
    top: 0px;
    font-size: 12px;
    color: rgb(182, 181, 181);
}
.item label{
    position: absolute;
    left: 0;
    top: 12px;
    transition: all 0.3s linear;
    color: rgba(0,0,0,0.45);
}
.btn{
    line-height: 40px;
    box-sizing: border-box;
    width: 88%;
    height: 40px;
    border: 1px solid white;
    border-radius: 10px;
    color: #03e9f4;
    margin: 15px auto;
    transition: all 0.2s linear;
}
.btn:hover{
    background-color: #03e9f4;
    color: white;
    box-shadow: 0 0 5px 0 #03e9f4,
                0 0 25px 0 #03e9f4,
                0 0 50px 0 #03e9f4;
    text-transform: uppercase;
    cursor: pointer;
}
input,button{
    width: 100%;
    height: 100%;
    background-color: transparent;
    outline: none;
    border: none;
    padding-top: 20px;
    box-sizing: border-box;
}
</style>